package com.coolingme.demo.transparent;

/**
 * 课程，叶子结点
 *
 * @author wangyue
 * @date 2020-09-19 0:42
 */
public class Course extends CourseComponent {

    /**
     * 课程名
     */
    private String name;

    /**
     * 课程价格
     */
    private double price;

    public Course(String name, double price) {
        this.name = name;
        this.price = price;
    }

    @Override
    public String getName(CourseComponent component) {
        return this.name;
    }

    @Override
    public Double getPrice(CourseComponent component) {
        return this.price;
    }

    @Override
    public void print() {
        System.out.println(this.name + ":￥" + this.price);
    }
}
